Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(mount): avoid warning when stubbing #483

Conversation

cexbrayat
Copy link
Member

Now that we "properly" register stubs
(see this commit bb8023f),
a bunch of warning are logged by Vue when a test tries to stub an already registered component.

For example, vue-router-mock register RouterView and then stubs it
(see https://github.com/posva/vue-router-mock/blob/v2/src/injections.ts#L37-L41).
So if you use vue-router-mock (or a similar pattern) in your test, Vue logs:

[Vue warn]: Component "RouterView" has already been registered in target app.

because when a component is stubbed, we re-register it in VTU-next, and Vue warns us that it might be a mistake.

This is a quite naive fix, as it removes the already registered component before registering the stub.

Now that we "properly" register stubs
(see this commit vuejs@bb8023f),
a bunch of warning are logged by Vue when a test tries to stub an already registered component.

For example, vue-router-mock register RouterView and then stubs it
(see https://github.com/posva/vue-router-mock/blob/v2/src/injections.ts#L37-L41).
So if you use vue-router-mock (or a similar pattern) in your test, Vue logs:

    [Vue warn]: Component "RouterView" has already been registered in target app.

because when a component is stubbed, we re-register it in VTU-next, and Vue warns us that it might be a mistake.

This is a quite naive fix, as it removes the already registered component before registering the stub.
@cexbrayat
Copy link
Member Author

Superseeded by #504

@cexbrayat cexbrayat closed this Mar 30, 2021
@cexbrayat cexbrayat deleted the fix/vue-warning-when-registering-twice branch March 30, 2021 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant